package com.integral.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.integral.biz.IProductBiz;
import com.integral.entity.Product;
import com.integral.vo.ProductVo;

/**
 * 支付商品
 * @author zhaofan
 *
 */
@Controller
@RequestMapping("/product")
public class ProductController {

	@Resource
	private IProductBiz productBiz;

	/**
	 * 查询支付商品列表
	 * 
	 * @param productVo
	 * @return
	 */
	@RequestMapping(value="/findProduct")
	@ResponseBody
	public Map<String, Object> findProduct(ProductVo productVo) {

		List<ProductVo> list = productBiz.findProduct(productVo);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("total", productBiz.findProductCount(productVo));
		map.put("rows", list);
		return map;
	}
	
	/**
	 * 修改支付商品
	 * @param product
	 */
	@RequestMapping(value="/updateProduct")
	public String updateProduct(Product product){
		productBiz.updateProduct(product);
		return "management/product";
	}
}
